package com.yitong.equipment.view

import android.app.Activity
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import com.yitong.equipment.view.dialog.PrivacyNewDialog

class DialogFactory {
    private var mActivity: Activity?
    private var mFragmentManager: FragmentManager

    constructor(baseActivity: AppCompatActivity) {
        mActivity = baseActivity
        mFragmentManager = baseActivity.supportFragmentManager
    }

    constructor(baseFragment: Fragment) {
        mActivity = baseFragment.activity
        mFragmentManager = baseFragment.childFragmentManager
    }

    fun showPrivacyDialog(listener: View.OnClickListener?) {
        val dialog = PrivacyNewDialog()
        dialog.setClick(listener)
        mActivity?.let { dialog.show(it) }
    }


}